from multiprocessing import Process
li = []
p_list = []
def foo(i):
    li.append(i)
    print(li)
if __name__ == '__main__':
    for i in range(10):
        p = Process(target=foo, args=(i,))
        p_list.append(p)
    for p in p_list:
        p.start()
    for p in p_list:
        p.join()
    print('ending', li)